home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
037a
/
newer.zip
/
NEWER.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1991-12-04
|
1KB
|
55 lines
program Newer;
{ compares two file datestamps. returns errorlevel
0 if 1 < 2,
1 if 1 = 2,
2 if 1 > 2,
3 if error. }
{ Written by Steven Key }
uses DOS, Crt ;
var
f1,f2 : file ;
t1,t2 : longint ;
code : word ;
begin
code:=3; { set return to error as default. }
if paramcount > 1 then
begin { main code }
{$I- }
assign (f1,paramstr(1));
reset(f1);
if IoResult <> 0 then
begin
writeln('Error opening ',paramstr(1));
exit
end;
assign (f2,paramstr(2));
reset(f2);
if IoResult <> 0 then
begin
writeln('Error opening ',paramstr(2));
exit
end;
{$I+ }
GetFTime(f1,t1);
GetFTime(f2,t2);
If t1 < t2 then code := 0;
If t1 = t2 then code := 1;
if t1 > t2 then code := 2;
end
else
begin
writeln('Format: NEWER FILE1 FILE2');
writeln;
writeln('errorlevel = 0 if 1 older than 2,');
writeln(' 1 if same age,');
writeln(' 2 if 1 newer than 2,');
writeln(' 3 if error.');
end;
halt(code) { return code to batch file. }
end.